package com.selfstudy.system.service.impl;

import java.util.List;
import com.selfstudy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.selfstudy.system.mapper.SRoomMapper;
import com.selfstudy.system.domain.SRoom;
import com.selfstudy.system.service.ISRoomService;

/**
 * 自习室Service业务层处理
 * 
 * @author lgf
 * @date 2024-01-29
 */
@Service
public class SRoomServiceImpl implements ISRoomService 
{
    @Autowired
    private SRoomMapper sRoomMapper;

    /**
     * 查询自习室
     * 
     * @param roomId 自习室主键
     * @return 自习室
     */
    @Override
    public SRoom selectSRoomByRoomId(Long roomId)
    {
        return sRoomMapper.selectSRoomByRoomId(roomId);
    }

    /**
     * 查询自习室列表
     * 
     * @param sRoom 自习室
     * @return 自习室
     */
    @Override
    public List<SRoom> selectSRoomList(SRoom sRoom)
    {
        return sRoomMapper.selectSRoomList(sRoom);
    }

    /**
     * 新增自习室
     * 
     * @param sRoom 自习室
     * @return 结果
     */
    @Override
    public int insertSRoom(SRoom sRoom)
    {
        sRoom.setCreateTime(DateUtils.getNowDate());
        return sRoomMapper.insertSRoom(sRoom);
    }

    /**
     * 修改自习室
     * 
     * @param sRoom 自习室
     * @return 结果
     */
    @Override
    public int updateSRoom(SRoom sRoom)
    {
        sRoom.setUpdateTime(DateUtils.getNowDate());
        return sRoomMapper.updateSRoom(sRoom);
    }

    /**
     * 批量删除自习室
     * 
     * @param roomIds 需要删除的自习室主键
     * @return 结果
     */
    @Override
    public int deleteSRoomByRoomIds(Long[] roomIds)
    {
        return sRoomMapper.deleteSRoomByRoomIds(roomIds);
    }

    /**
     * 删除自习室信息
     * 
     * @param roomId 自习室主键
     * @return 结果
     */
    @Override
    public int deleteSRoomByRoomId(Long roomId)
    {
        return sRoomMapper.deleteSRoomByRoomId(roomId);
    }
}
